package com.sec.android.app.myfiles.facade.cmd;

import android.content.Context;

import com.sec.android.app.myfiles.fragment.AbsMyFilesFragment;
import com.sec.android.app.myfiles.util.PreferenceUtils;

import org.puremvc.java.multicore.interfaces.INotification;
import org.puremvc.java.multicore.patterns.command.SimpleCommand;

public class ShowHiddenFileCmd extends SimpleCommand {
    @Override
    public void execute(INotification notification) {
        Object[] params = (Object[]) notification.getBody();

        Context context = (Context) params[0];
        AbsMyFilesFragment fragment = (AbsMyFilesFragment) params[1];

        boolean showHiddenFiles = PreferenceUtils.getShowHiddenFiles(context);
        PreferenceUtils.setShowHiddenFiles(context, !showHiddenFiles);

        if (fragment != null) {
            fragment.reload();
        }
    }
}
